package cn.wolfcode.shop.util;

import org.apache.commons.codec.digest.DigestUtils;

public class MD5Util {
    public static String salt = "1a2b3c4d";
    public static String md5(String value){
        return DigestUtils.md5Hex(value);
    }
    //用来做实验模拟前台加密后传来的密文
    public static String inputPassToFormPass(String password){
        return md5(""+salt.charAt(0)+salt.charAt(2)+password+salt.charAt(5)+salt.charAt(4));
    }
    public static String formPassToDbPass(String formPass,String salt){
        return md5(""+salt.charAt(0)+salt.charAt(2)+formPass+salt.charAt(5)+salt.charAt(4));
    }

    public static void main(String[] args) {
        String formPassword = inputPassToFormPass("111111");
        String dbPassword = formPassToDbPass(formPassword,"d4c3b2a1");
    }
}
